<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="../../../../lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.useso.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="../../../../lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="../../../../css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="../../../../images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="../../../../images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="../../../../images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="../../../../images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="ELK,kafka,zookeeper,">










<meta name="description" content="上篇博文主要总结了一下elk、基于kafka的zookeeper集群搭建，以及系统日志通过zookeeper集群达到我们集群的整个过程。下面我们接着下面这个未完成的几个主题 4.Kibana部署; 5.Nginx负载均衡Kibana请求; 6.案例：nginx日志收集以及MySQL慢日志收集; 7.Kibana报表基本使用;   Kibana的部署;Kibana的作用，想必大家都知道了就是一个展示">
<meta name="keywords" content="ELK,kafka,zookeeper">
<meta property="og:type" content="article">
<meta property="og:title" content="ELK+Kafka 企业日志收集平台(二)">
<meta property="og:url" content="http://demo_demo.gitee.io/2015/11/14/elkkafka-e4-bc-81-e4-b8-9a-e6-97-a5-e5-bf-97-e6-94-b6-e9-9b-86-e5-b9-b3-e5-8f-b0-e4-ba-8c/index.html">
<meta property="og:site_name" content="运维人">
<meta property="og:description" content="上篇博文主要总结了一下elk、基于kafka的zookeeper集群搭建，以及系统日志通过zookeeper集群达到我们集群的整个过程。下面我们接着下面这个未完成的几个主题 4.Kibana部署; 5.Nginx负载均衡Kibana请求; 6.案例：nginx日志收集以及MySQL慢日志收集; 7.Kibana报表基本使用;   Kibana的部署;Kibana的作用，想必大家都知道了就是一个展示">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/22.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/13.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/16.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/15.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/17.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/18.png">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/19.png">
<meta property="og:updated_time" content="2018-12-10T10:28:44.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ELK+Kafka 企业日志收集平台(二)">
<meta name="twitter:description" content="上篇博文主要总结了一下elk、基于kafka的zookeeper集群搭建，以及系统日志通过zookeeper集群达到我们集群的整个过程。下面我们接着下面这个未完成的几个主题 4.Kibana部署; 5.Nginx负载均衡Kibana请求; 6.案例：nginx日志收集以及MySQL慢日志收集; 7.Kibana报表基本使用;   Kibana的部署;Kibana的作用，想必大家都知道了就是一个展示">
<meta name="twitter:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://demo_demo.gitee.io/2015/11/14/elkkafka-e4-bc-81-e4-b8-9a-e6-97-a5-e5-bf-97-e6-94-b6-e9-9b-86-e5-b9-b3-e5-8f-b0-e4-ba-8c/">





  <title>ELK+Kafka 企业日志收集平台(二) | 运维人</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
<a href="https://github.com/guomaoqiu" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#FD6C6C; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">运维人</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">生命在于折腾</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://demo_demo.gitee.io">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="OutMan">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="运维人">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">ELK+Kafka 企业日志收集平台(二)</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-11-14T16:49:57+08:00">
                2015-11-14
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Monitor/" itemprop="url" rel="index">
                    <span itemprop="name">Monitor</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Monitor/Other/" itemprop="url" rel="index">
                    <span itemprop="name">Other</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Monitor/Other/自动化运维/" itemprop="url" rel="index">
                    <span itemprop="name">自动化运维</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>上篇博文主要总结了一下elk、基于kafka的zookeeper集群搭建，以及系统日志通过zookeeper集群达到我们集群的整个过程。下面我们接着下面这个未完成的几个主题 4.Kibana部署; 5.Nginx负载均衡Kibana请求; 6.案例：nginx日志收集以及MySQL慢日志收集; 7.Kibana报表基本使用;  </p>
<h3 id="Kibana的部署"><a href="#Kibana的部署" class="headerlink" title="Kibana的部署;"></a>Kibana的部署;</h3><p>Kibana的作用，想必大家都知道了就是一个展示工具，报表内容非常的丰富； 下面我们在两台es上面搭建两套kibana 1.获取kibana软件包</p>
<p>[root@es1 ~]# wget <a href="https://download.elastic.co/kibana/kibana/kibana-4.1.2-linux-x64.tar.gz" target="_blank" rel="noopener">https://download.elastic.co/kibana/kibana/kibana-4.1.2-linux-x64.tar.gz</a><br>[root@es1 ~]# tar -xf kibana-4.2.0-linux-x64.tar.gz -C /usr/local/</p>
<p>2.修改配置文件</p>
<p>[root@es1 ~]# cd /usr/local/<br>[root@es1 local]# ln -sv kibana-4.1.2-linux-x64 kibana<br>`kibana’ -&gt; `kibana-4.2.0-linux-x64’<br>[root@es1 local]# cd kibana</p>
<p>[root@es1 kibana]# vim config/kibana.yml<br>server.port: 5601      #默认端口可以修改的<br>server.host: “0.0.0.0” #kibana监听的ip<br>elasticsearch.url: “<a href="http://localhost:9200&quot;" target="_blank" rel="noopener">http://localhost:9200&quot;</a> #由于es在本地主机上面，所以这个选项打开注释即可</p>
<p>3.提供kibana服务管理脚本，我这里写了个相对简单的脚本</p>
<p>[root@es1 config]# cat /etc/init.d/kibana</p>
<p>#!/bin/bash</p>
<p>#chkconfig: 2345 55 24</p>
<p>#description: kibana service manager</p>
<p>KIBBIN=’/usr/local/kibana/bin/kibana’<br>LOCK=’/usr/local/kibana/locks’</p>
<p>START() {<br>    if [ -f $LOCK ];then<br>        echo -e “kibana is already \033[32mrunning\033[0m, do nothing.”<br>    else<br>        echo -e “Start kibana service.\033[32mdone\033[m”<br>        cd  /usr/local/kibana/bin<br>        nohup ./kibana &amp; &gt;/dev/null<br>         touch $LOCK<br>    fi<br>}</p>
<p>STOP() {<br>    if [ ! -f $LOCK ];then<br>        echo -e “kibana is already stop, do nothing.”<br>    else<br>        echo -e “Stop kibana serivce \033[32mdone\033[m”<br>        rm -rf $LOCK<br>        ps -ef | grep kibana | grep -v “grep” | awk ‘{print $2}’ | xargs kill -s 9 &gt;/dev/null<br>    fi<br>}</p>
<p>STATUS() {<br>        Port=$(netstat -tunl | grep “:5602”)<br>    if [ “$Port” != “” ] &amp;&amp; [ -f $LOCK ];then<br>        echo -e “kibana is: \033[32mrunning\033[0m…”<br>    else<br>        echo -e “kibana is: \033[31mstopped\033[0m…”<br>    fi<br>}</p>
<p>case “$1” in<br>  start)<br>    START<br>    ;;<br>  stop)<br>    STOP<br>    ;;<br>  status)<br>    STATUS<br>    ;;<br>  restart)<br>    STOP<br>    sleep 2<br>    START<br>    ;;<br>  *)<br>    echo “Usage: /etc/init.d/kibana (|start|stop|status|restart)”<br>    ;;<br>esac</p>
<p>4.启动kibana服务</p>
<p>[root@es1 config]# chkconfig –add kibana<br>[root@es1 config]# service kibana start<br>Start kibana service.done<br>[root@es1 config]#</p>
<p>5.服务检查</p>
<p>[root@es1 config]# ss -tunl | grep “5601”<br>tcp    LISTEN     0      511                    <em>:5601                  </em>:*<br>[root@es1 config]#</p>
<p>ok，此时我直接访问es1这台主机的5601端口 <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png" alt="11"></a> ok，能成功的访问5601端口，那我把es1这台的配置放到es2上面去然后启动，效果跟访问es1一样</p>
<h3 id="Nginx负载均衡kibana的请求"><a href="#Nginx负载均衡kibana的请求" class="headerlink" title="Nginx负载均衡kibana的请求"></a>Nginx负载均衡kibana的请求</h3><p>1.在nginx-proxy上面yum安装nginx</p>
<p>yum install -y nignx</p>
<p>2.编写配置文件es.conf</p>
<p>[root@saltstack-node1 conf.d]# pwd<br>/etc/nginx/conf.d<br>[root@saltstack-node1 conf.d]# cat es.conf<br>upstream es {<br>    server 192.168.2.18:5601 max_fails=3 fail_timeout=30s;<br>    server 192.168.2.19:5601 max_fails=3 fail_timeout=30s;<br>}</p>
<p>server {<br>    listen       80;<br>    server_name  localhost;</p>
<pre><code>location / {
    proxy_pass http://es/;
    index index.html index.htm;
    #auth
    auth_basic &quot;ELK Private&quot;;
    auth\_basic\_user_file /etc/nginx/.htpasswd;
}
</code></pre><p> }</p>
<p>3.创建认证</p>
<p>[root@saltstack-node1 conf.d]# htpasswd -cm /etc/nginx/.htpasswd elk<br>New password:<br>Re-type new password:<br>Adding password for user elk-user<br>[root@saltstack-node1 conf.d]# /etc/init.d/nginx restart<br>Stopping nginx:                                            [  OK  ]<br>Starting nginx:                                            [  OK  ]<br>[root@saltstack-node1 conf.d]# </p>
<p>4.直接输入认证用户及密码就可访问啦<a href="http://192.168.2.21/" target="_blank" rel="noopener">http://192.168.2.21/</a> <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/22.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/22.png" alt="22"></a></p>
<h3 id="Nginx及MySQL慢日志收集"><a href="#Nginx及MySQL慢日志收集" class="headerlink" title="Nginx及MySQL慢日志收集"></a>Nginx及MySQL慢日志收集</h3><p>首先我们在webserver1上面都分别安装了nginx 及mysql. 1.为了方便nginx日志的统计搜索，这里设置nginx访问日志格式为json (1)修改nginx主配置文件 说明：如果想实现日志的报表展示，最好将业务日志直接以json格式输出，这样可以极大减轻cpu负载，也省得运维需要写负载的filter过滤正则。</p>
<p>[root@webserver1 nginx]# vim nginx.conf<br>log_format json ‘{“@timestamp”:”$time_iso8601”,’<br>                ‘“@version”:”1”,’<br>                ‘“client”:”$remote_addr”,’<br>                ‘“url”:”$uri”,’<br>                ‘“status”:”$status”,’<br>                ‘“domain”:”$host”,’<br>                ‘“host”:”$server_addr”,’<br>                ‘“size”:$body_bytes_sent,’<br>                ‘“responsetime”:$request_time,’<br>                ‘“referer”: “$http_referer”,’<br>                ‘“ua”: “$http_user_agent”‘<br>                ‘}’;<br>  access_log  /var/log/access_json.log  json;</p>
<p>(2)收集nginx日志和MySQL日志到消息队列中；这个文件我们是定义在客户端，即生产服务器上面的Logstash文件哦. 注意：这里刚搭建完毕，没有什么数据，为了展示效果，我这里导入了线上的nginx和MySQL慢日志</p>
<p>input {<br>  file {             #从nginx日志读入<br>    type =&gt; “nginx-access”<br>    path =&gt; “/var/log/nginx/access.log”<br>    start_position =&gt; “beginning”<br>    codec =&gt; “json”  #这里指定 codec格式为json<br>  }<br>  file {  #从MySQL慢日志读入<br>   type =&gt; “slow-mysql”<br>   path =&gt; “/var/log/mysql/slow-mysql.log”<br>   start_position =&gt; “beginning”<br>   codec =&gt; multiline {         #这里用到了logstash的插件功能，将本来属于一行的多行日志条目整合在一起，让他属于一条<br>     pattern =&gt; “^# User@Host”  #用到了正则去匹配<br>     negate =&gt; true<br>     what =&gt; “previous”<br>   }<br>  }<br>}</p>
<p>output {<br>#  stdout { codec=&gt; rubydebug }<br>  if [type] == “nginx-access” {    #通过判断input中定义的type，来让它在kafka集群中生成的主题名称<br>    kafka {                        #输出到kafka集群<br>      bootstrap_servers =&gt; “192.168.2.22:9092,192.168.2.23:9092,192.168.2.24:9092”  #生产者们<br>      topic_id =&gt; “nginx-access”   #主题名称<br>      compression_type =&gt; “snappy” #压缩类型<br>    }<br> }<br>  if [type] == “slow-mysql” {<br>    kafka {<br>      bootstrap_servers =&gt; “192.168.2.22:9092,192.168.2.23:9092,192.168.2.24:9092”<br>      topic_id =&gt; “slow-mysql”<br>      compression_type =&gt; “snappy”<br>    }<br> }<br>}</p>
<p>(3)Logstash 从kafka集群中读取日志存储到es中，这里的定义logstash文件是在三台kafka服务器上面的哦，并且要保持一致，你可以在一台上面修改测试好之后，拷贝至另外两台即可。</p>
<p>input {<br>    kafka {<br>        zk_connect =&gt; “192.168.2.22:2181,192.168.2.23:2181,192.168.2.24:2181”<br>        type =&gt; “nginx-access”<br>        topic_id =&gt; “nginx-access”<br>        codec =&gt; plain<br>        reset_beginning =&gt; false<br>        consumer_threads =&gt; 5<br>        decorate_events =&gt; true<br>    }<br>    kafka {<br>        zk_connect =&gt; “192.168.2.22:2181,192.168.2.23:2181,192.168.2.24:2181”<br>        type =&gt; “slow-mysql”<br>        topic_id =&gt; “slow-mysql”<br>        codec =&gt; plain<br>        reset_beginning =&gt; false<br>        consumer_threads =&gt; 5<br>        decorate_events =&gt; true<br>    }<br>}</p>
<p>output {<br>#  stdout { codec=&gt; rubydebug }<br>  if [type] == “nginx-access” {<br>    elasticsearch {<br>      hosts =&gt; [“192.168.2.18:9200”,”192.168.2.19:9200”]<br>      index =&gt; “nginx-access-%{+YYYY-MM}”<br>    }<br>  }<br>  if [type] == “slow-mysql” {<br>    elasticsearch {<br>      hosts =&gt; [“192.168.2.18:9200”,”192.168.2.19:9200”]<br>      index =&gt; “slow-mysql-%{+YYYY-MM}”<br>    }<br>  }<br>}</p>
<p><a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/13.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/13.png" alt="13"></a> 通过上图可以看到，nginx日志以及MySQL慢日志已经成功抵达es集群 然后我们在kibana上面创建索引就可以啦 (4)创建nginx-access 日志索引 <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/11.png" alt="11"></a> 此时就可以看到索引啦 <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/16.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/16.png" alt="16"></a> (5)创建MySQL慢日志索引 p<a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/15.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/15.png" alt="15"></a> MySQL的索引也出来啦 <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/17.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/17.png" alt="17"></a>Kibana报表展示 kibana报表功能非常的强大，也就是可视化；可以制作出下面不同类型的图形 <a href="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/18.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/18.png" alt="18"></a> 下面就是我简单的一些图形展示 <img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2015/11/19.png" alt="19"> 由于篇幅问题，可以看官方介绍。 参考： <a href="https://github.com/liquanzhou/ops_doc/tree/master/Service/kafka" target="_blank" rel="noopener">https://github.com/liquanzhou/ops_doc/tree/master/Service/kafka</a> <a href="http://www.lujinhong.com/kafka%E9%9B%86%E7%BE%A4%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97.html" target="_blank" rel="noopener">http://www.lujinhong.com/kafka%E9%9B%86%E7%BE%A4%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97.html</a> <a href="http://www.it165.net/admin/html/201405/3192.html" target="_blank" rel="noopener">http://www.it165.net/admin/html/201405/3192.html</a> <a href="http://blog.csdn.net/lizhitao/article/details/39499283" target="_blank" rel="noopener">http://blog.csdn.net/lizhitao/article/details/39499283</a> <a href="https://taoistwar.gitbooks.io/spark-operationand-maintenance-management/content/spark_relate_software/zookeeper_install.html" target="_blank" rel="noopener">https://taoistwar.gitbooks.io/spark-operationand-maintenance-management/content/spark_relate_software/zookeeper_install.html</a></p>

      
    </div>
    
    
    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>


  
</div>
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="../../../../tags/ELK/" rel="tag"># ELK</a>
          
            <a href="../../../../tags/kafka/" rel="tag"># kafka</a>
          
            <a href="../../../../tags/zookeeper/" rel="tag"># zookeeper</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="../elkkafka-e4-bc-81-e4-b8-9a-e6-97-a5-e5-bf-97-e6-94-b6-e9-9b-86-e5-b9-b3-e5-8f-b0-e4-b8-80/" rel="next" title="ELK+Kafka 企业日志收集平台(一)">
                <i class="fa fa-chevron-left"></i> ELK+Kafka 企业日志收集平台(一)
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="../../19/saltstack-e5-88-a9-e7-94-a8returners-e7-a8-8b-e5-ba-8f-e4-bf-9d-e5-ad-98-e6-89-a7-e8-a1-8c-e7-bb-93-e6-9e-9c-e5-88-b0mysql/" rel="prev" title="Saltstack利用Returners程序保存执行结果到mysql">
                Saltstack利用Returners程序保存执行结果到mysql <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png" alt="OutMan">
            
              <p class="site-author-name" itemprop="name">OutMan</p>
              <p class="site-description motion-element" itemprop="description">😊</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="../../../../archives/">
              
                  <span class="site-state-item-count">79</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="../../../../categories/index.html">
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="../../../../tags/index.html">
                  <span class="site-state-item-count">46</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/guomaoqiu" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:guomaoqiu@google.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Kibana的部署"><span class="nav-number">1.</span> <span class="nav-text">Kibana的部署;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Nginx负载均衡kibana的请求"><span class="nav-number">2.</span> <span class="nav-text">Nginx负载均衡kibana的请求</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Nginx及MySQL慢日志收集"><span class="nav-number">3.</span> <span class="nav-text">Nginx及MySQL慢日志收集</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">OutMan</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="../../../../lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="../../../../js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="../../../../js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="../../../../js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="../../../../js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="../../../../js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
